<%@ page language="java" import="dao.*" pageEncoding="UTF-8" %>
<%@ page language="java" import="java.util.*" %>
<%@page import="util.*" %>


<%@ include file="head.jsp" %>
<script src="js/jquery.validate.js"></script>
<script src="js/datepicker/WdatePicker.js"></script>

<div style="padding: 10px">


    <% if (request.getSession().getAttribute("username") == null || "".equals(request.getSession().getAttribute("username"))) { %>
    <script>
        alert('对不起,请您先登陆!');
        location.href = 'login.jsp';
    </script>
    <%
            return;
        } %>


    <% if (null == request.getParameter("id") || "".equals(request.getParameter("id"))) { %>
    <script>
        alert('非法操作');
        history.go(-1);
    </script>
    <% out.close(); %>
    <% } %>        <% HashMap readMap = Query.make("shangpinxinxi").where("id", request.getParameter("id")).find(); %>


    <div class="container"><!-- 使用bootstrap css框架，container定宽，并剧中 https://v3.bootcss.com/css/#overview-container -->
        <div class="panel panel-default">
            <div class="panel-heading">
                添加下单:
            </div>
            <div class="panel-body">
                <form action="xiadan.jsp?a=insert" method="post" name="form1" id="form1"><!-- form 标签开始 -->
                    <div class="form-group">
                        <div class="row">
                            <label style="width: 120px;min-height:18px;text-align: right" class="col-sm-2">商品编号</label>
                            <div class="col-sm-8">

                                <%= readMap.get("shangpinbianhao") %><input type="hidden" id="shangpinbianhao"
                                                                            name="shangpinbianhao"
                                                                            value="<%= Info.html(readMap.get("shangpinbianhao")) %>"/>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="row">
                            <label style="width: 120px;min-height:18px;text-align: right" class="col-sm-2">商品名称</label>
                            <div class="col-sm-8">

                                <%= readMap.get("shangpinmingcheng") %><input type="hidden" id="shangpinmingcheng"
                                                                              name="shangpinmingcheng"
                                                                              value="<%= Info.html(readMap.get("shangpinmingcheng")) %>"/>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="row">
                            <label style="width: 120px;min-height:18px;text-align: right" class="col-sm-2">售价</label>
                            <div class="col-sm-8">

                                <%= readMap.get("shoujia") %><input type="hidden" id="shoujia" name="shoujia"
                                                                    value="<%= Info.html(readMap.get("shoujia")) %>"/>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="row">
                            <label style="width: 120px;min-height:18px;text-align: right" class="col-sm-2">商品分类</label>
                            <div class="col-sm-8">

                                <%
                                    HashMap mapshangpinfenlei14 = new CommDAO().find("SELECT fenleimingcheng FROM shangpinfenlei where id='" + readMap.get("shangpinfenlei") + "'");
                                %><%= mapshangpinfenlei14.get("fenleimingcheng") %><input type="hidden"
                                                                                          id="shangpinfenlei"
                                                                                          name="shangpinfenlei"
                                                                                          value="<%= Info.html(readMap.get("shangpinfenlei")) %>"/>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="row">
                            <label style="width: 120px;min-height:18px;text-align: right" class="col-sm-2">发布人</label>
                            <div class="col-sm-8">

                                <%= readMap.get("faburen") %><input type="hidden" id="faburen" name="faburen"
                                                                    value="<%= Info.html(readMap.get("faburen")) %>"/>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="row">
                            <label style="width: 120px;min-height:18px;text-align: right" class="col-sm-2">联系电话<span
                                    style="color: red;">*</span></label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" style="width:150px;" data-rule-required="true"
                                       data-msg-required="请填写联系电话" phone="true" data-msg-phone="请输入正确手机号码"
                                       id="lianxidianhua" name="lianxidianhua" value=""/></div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="row">
                            <label style="width: 120px;min-height:18px;text-align: right" class="col-sm-2">交易时间<span
                                    style="color: red;">*</span></label>

                            <div class="col-sm-8">
                                <input type="text" class="form-control" style="width:150px;" data-rule-required="true"
                                       data-msg-required="请填写交易时间" id="jiaoyishijian" name="jiaoyishijian" value=""/>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="row">
                            <label style="width: 120px;min-height:18px;text-align: right" class="col-sm-2">交易地点<span
                                    style="color: #ff0000;">*</span></label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" style="width:150px;" data-rule-required="true"
                                       data-msg-required="请填写交易地点" id="jiaoyididian" name="jiaoyididian" value=""/>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="row">
                            <label style="width: 120px;min-height:18px;text-align: right" class="col-sm-2">下单人</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" style="width:150px;" readonly="readonly"
                                       id="xiadanren" name="xiadanren"
                                       value="<%= request.getSession().getAttribute("username") !=null ? request.getSession().getAttribute("username") : "" %>"/>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="row">
                            <label style="width: 120px;min-height:18px;text-align: right" class="col-sm-2"> </label>
                            <div class="col-sm-8">
                                <input type="hidden" name="shangpinxinxiid"
                                       value="<%= request.getParameter("id") !=null ? request.getParameter("id") : "" %>"/><input
                                    name="referer" value="<%=request.getHeader("referer")%>" type="hidden"/><input
                                    type="hidden" name="jiaoyizhuangtai" id="jiaoyizhuangtai" value="待交易"/><input
                                    type="hidden" name="iszf" value="否"/>
                                <button type="submit" class="btn btn-primary" name="Submit">
                                    提交
                                </button>
                                <button type="reset" class="btn btn-default" name="Submit2">
                                    重置
                                </button>
                            </div>
                        </div>
                    </div><!--form标签结束--></form>
            </div>
        </div>
        <!-- container定宽，并剧中结束 --></div>
    <script>
        $(function () {
            $('#form1').validate();
        });
    </script>
</div>
<%@ include file="foot.jsp" %>
